#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void)
{
    srand(time(NULL));
    int cnt = 0, i = 0, num, temp, num2;
    while (i < 10) {
        num = rand() % (int) 1e8; // 限制数据范围，避免反转后数据溢出
        printf("%d ", num);
        temp = num;
        num2 = 0;
        while (temp) {
            num2 = num2 * 10 + temp % 10;
            temp /= 10;
        }
        //printf("%d\n ", num2);
        if (num == num2) 
            cnt++;
        i++;
    }

    printf("\ncnt = %d\n", cnt);
    return 0;
}



